#include <linux/module.h>
#include<linux/platform_device.h>


static void demo_release(struct device *dev)
{
    printk("v4l2 dev release\n");
}

static struct platform_device demo_dev = {
    .name   = "v4l2_dev",
    .id     = -1,
    .dev    = {
        .release = demo_release,
    },
};

static int __init demo_init(void)
{
    int ret;

    printk("v4l2 dev init\n");
    ret = platform_device_register(&demo_dev);
    if (ret) {
        printk("register failed\n");
        return -1;
    }
    return 0;
}

static void __exit demo_exit(void)
{
    printk("v4l2 dev exit\n");
    platform_device_unregister(&demo_dev);
}


module_init(demo_init);
module_exit(demo_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("ChongYu");
MODULE_DESCRIPTION("v4l2 device");
